package com.zyh.homeworkzhuantike;

public class Test7 {
    public static void main(String[] args) {
        /*
        定义一个方法，用于比较两个数组的内容是否相同
      {1，2，3，4，5}
      {5，4，3，2，1}
         */
        int[] arr1 = {1, 2, 3, 4, 5};
        int[] arr2 = {5, 4, 3, 2, 1};
        boolean same = isSame(arr1, arr2);
        System.out.println("same = " + same);
    }

    public static boolean isSame(int[] arr1, int[] arr2) {
        if (arr1.length != arr2.length) {
            return false;
        } else {
            for (int i = 0; i < arr1.length; i++) {
                if (arr1[i] != arr2[i]) {
                    return false;
                }
            }
        }
        return true;
    }
}
